package com.ctrip.ec.biz;

import com.aliyuncs.exceptions.ClientException;
import com.ctrip.ec.biz.dao.para.ParaDao;
import com.ctrip.ec.biz.dao.sequence.SequenceDao;
import com.ctrip.ec.biz.entity.role.SysRole;
import com.ctrip.ec.biz.entity.sequence.SequenceEntity;
import com.ctrip.ec.biz.entity.user.UserEntity;
import com.ctrip.ec.biz.util.SerialCodeGen;
import com.ctrip.ec.biz.util.SmsUtil;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Value;

import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
import java.sql.Date;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;

/**
 * Created by jiangzy on 2018/8/31.
 */
public class MyTest {

//    @Value("${env}")
//    private  String env;

    @Test
    public  void test() throws ClientException, SQLException {

        LoadingCache<String, UserEntity> cache = CacheBuilder.newBuilder()
                .maximumSize(1000)
                .expireAfterAccess(30L, TimeUnit.MILLISECONDS)
                .build(new CacheLoader<String, UserEntity>() {
                    @Override
                    public UserEntity load(String s) throws Exception {
                        return null;
                    }
                });


       // TimeUnit.SECONDS.sleep(3);
    }

    public CacheLoader<String, UserEntity> createCacheLoader() {
        return new com.google.common.cache.CacheLoader<String, UserEntity>() {
            @Override
            public UserEntity load(String key) throws Exception {

                return new UserEntity();
            }
        };
    }
}
